<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>清除浮动</title>
    <style>
        body,div {
            margin: 0;
            padding: 0;
        }
        #header,#left, #middle, #right, #footer {
            border: 1px solid red;
            height: 50px;
        }
        #header {
            width: 100%;
        }
        #left, #middle, #right {
            float: left;
            width: 33%;
        }
        #left {
            height: 100px;
        }
        /* 方法二（推荐） */
        #clear {
            clear: both;
        }
        #footer {
            border-color: #000000;
            /* 方法一 */
            /* clear: left; */

        }
    </style>
</head>
<body>
    <div id="header">Header</div>
    <div id="left">Left</div>
    <div id="middle">middle</div>
    <div id="right">rigth</div>
    <!-- 方法二 -->
    <div id="clear"></div>
    <div id="footer">footer</div>
</body>
</html>